﻿using Autodesk.Revit.UI;
using AutoRevit.Entry.Application;
using AutoRevit.Ribbon;
using AutoRevit.Ribbon.Ribbon.Mapper;
using AutoRevitDemo.TestExternalCommand;

namespace AutoRevitDemo.Modules;

internal class UIModule : IExternalModule
{
    public Result OnShutdown(UIControlledApplication application)
    {
        return Result.Succeeded;
    }

    public Result OnStartup(UIControlledApplication application)
    {
        var panelMapper = new PanelMapper("AutoRevitDemo")
        {
            Items =
            [
                new PushButtonMapper<EventCommand>("Event"),
                new PushButtonMapper<InterceptorCommand>("Interceptor"),
                new PushButtonMapper<HotUpdateCommand>("HotUpdate"),
                new PushButtonMapper<PermissionValidationCommand>("PermissionValidation"),
                new PushButtonMapper<GetWallAutoExternalCommand>("GetWall"),
                new PushButtonMapper<GetPanelAutoExternalCommand>("GetPanel"),
                new PushButtonMapper<YouerFuncAutoExternalCommand>("YouerFunc"),
                new PushButtonMapper<DeleteWallCommand>("DeleteWall"),
                new PushButtonMapper<MyNamespace.Command.LoadDataAutoExternalCommand>("DeleteWall"),
            ]
        };

        new ControlManager(application).Map([panelMapper]);

        return Result.Succeeded;
    }
}